﻿using iMES.Core.Enums;
using iMES.Core.Filters;
using iMES.Entity.DomainModels;
using iMES.WorkManShip.IRepositories;
using iMES.WorkManShip.IServices;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using System.Threading.Tasks;

namespace iMES.WebApi.Controllers
{
    public partial class Team_PlanController 
    {
        private readonly ITeam_PlanService _service;//访问业务代码
        private readonly ITeam_ShiftsPlanService _shiftsPlanService;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;
        [ActivatorUtilitiesConstructor]
        public Team_PlanController(ITeam_PlanService service, IHttpContextAccessor httpContextAccessor, ITeam_ShiftsPlanService shiftsPlanService) : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
            _shiftsPlanService = shiftsPlanService;
        }
        /// <summary>
        /// 获取table1的数据
        /// </summary>
        /// <param name="loadData"></param>
        /// <returns></returns>
        [Route("getTable1Data"), HttpPost, ApiActionPermission("Team_Planning", ActionPermissionOptions.Search)]
        public async Task<IActionResult> GetTable1Data([FromBody] PageDataOptions loadData)
        {
            return JsonNormal(await Service.GetTable1Data(loadData));
        }

        /// <summary>
        /// 获取table1的数据
        /// </summary>
        /// <param name="loadData"></param>
        /// <returns></returns>
        [Route("getTable2Data"), HttpPost, ApiActionPermission("Team_Planning", ActionPermissionOptions.Search)]
        public async Task<IActionResult> GetTable2Data([FromBody] PageDataOptions loadData)
        {
            return JsonNormal(await Service.GetTable2Data(loadData));
        }
    }
}
